Ext.namespace('App', 'App.user');
/**
 * App.user.WhoIsOnline
 * 
 */
App.user.WhoIsOnline = Ext.extend(Ext.Window, {
	//applyTo:'hello-win',
	id: 'userWhoIsOnline',
    title: 'Usuarios Online',
    width:250,
    height:400,
    iconCls: 'icon-user',
    //shim:false,
    animCollapse:false,
    constrainHeader:true,
	closeAction:'hide',
	maximizable: true,
    layout: 'fit',
	
	application: null,
	
	//layout:'accordion',
    border:false,
    layoutConfig: {
        animate:false
    },
	
	/**
	 * 
	 */
	initComponent : function() {
	    this.items = [
	        new Ext.tree.TreePanel({
	            id:'im-tree',
	            title: '',
	            loader: new Ext.tree.TreeLoader({
	            	dataUrl   : BASE_URL + 'users/getOnlineUsers'
	                //baseParams: Drupal.settings.neologism
	            }),
	            rootVisible:false,
	            lines:false,
	            autoScroll:true,
	            tools:[{
	                id:'refresh',
	                on:{
	                    click: function(){
	                        var tree = Ext.getCmp('im-tree');
	                        tree.body.mask('Loading', 'x-mask-loading');
	                        tree.root.reload();
	                        tree.root.collapse(true, false);
	                        setTimeout(function(){ // mimic a server call
	                            tree.body.unmask();
	                            tree.root.expand(true, true);
	                        }, 1000);
	                    }
	                }
	            }],
	            root: new Ext.tree.AsyncTreeNode({
	            	text	: 'Usuarios Online',
	                id		: 'root',                  // this IS the id of the startnode
	                iconCls : 'class-samevoc'
	            }),
	            /*	
	            root: new Ext.tree.AsyncTreeNode({
	                text:'Online',
	                children:[{
	                    text:'Usuarios',
	                    expanded:true,
	                    children:[{
	                        text:'Jack',
	                        iconCls:'silk-user',
	                        leaf:true
	                    },{
	                        text:'Brian',
	                        iconCls:'silk-user',
	                        leaf:true
	                    },{
	                        text:'Jon',
	                        iconCls:'silk-user',
	                        leaf:true
	                    },{
	                        text:'Tim',
	                        iconCls:'silk-user',
	                        leaf:true
	                    },{
	                        text:'Nige',
	                        iconCls:'silk-user',
	                        leaf:true
	                    },{
	                        text:'Fred',
	                        iconCls:'silk-user',
	                        leaf:true
	                    },{
	                        text:'Bob',
	                        iconCls:'silk-user',
	                        leaf:true
	                    }]
	                },{
	                    text:'Visitantes',
	                    expanded:true,
	                    children:[{
	                        text:'Kelly',
	                        iconCls:'user-girl',
	                        leaf:true
	                    },{
	                        text:'Sara',
	                        iconCls:'user-girl',
	                        leaf:true
	                    },{
	                        text:'Zack',
	                        iconCls:'user-kid',
	                        leaf:true
	                    },{
	                        text:'John',
	                        iconCls:'user-kid',
	                        leaf:true
	                    }]
	                }]
	            })
	        	*/
	        })
	    ];
		
        // super
		App.user.WhoIsOnline.superclass.initComponent.call(this);
    }
    
});
